package com.hehua.BuilderTwo;

import org.w3c.dom.Document;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.File;

public class XmlUtil {
   public static Object getBean() throws Exception {
       DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
       DocumentBuilder builder = factory.newDocumentBuilder();
       Document document = null;
       document = builder.parse(new File("src//com//hehua//BuilderTwo//build.xml"));
       String nodeValue = document.getElementsByTagName("className").item(0).getFirstChild().getNodeValue();
       Class<?> aClass = Class.forName(nodeValue);
       return aClass.newInstance();
   }
}
